#include "Logger.hpp"
#include "UpSever.hpp"
#include "Dictionary.hpp"
#include <memory>

using namespace LogMudule;
using namespace DicMudule;

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        LOG(LogLevel::FATAL) << argv[0] << "severport";
        Die(USAGE_ERR);
    }

    uint16_t port = std::stoi(argv[1]);

    std::shared_ptr<Dictionary> dic_ptr = std::make_shared<Dictionary>();
    std::unique_ptr<UpSever> sev_ptr = std::make_unique<UpSever>([&dic_ptr]\
    (const std::string str){return dic_ptr->Translate(str);},port);
    sev_ptr->SeverInit();
    sev_ptr->Start();

    return 0;
}